package logic

import (
	"context"
	"manage/models/mysql"

	"manage/managerpc/internal/svc"
	"manage/managerpc/managerpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ActivityShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewActivityShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ActivityShowLogic {
	return &ActivityShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 活动详情
func (l *ActivityShowLogic) ActivityShow(in *managerpc.ActivityShowRequest) (*managerpc.ActivityShowResponse, error) {
	// todo: add your logic here and delete this line
	var user mysql.Activity
	mysql.DB.Where("id = ?", in.Id).Find(&user)
	return &managerpc.ActivityShowResponse{
		Id:     int64(user.ID),
		UserId: int64(user.UserId),
		Title:  user.Title,
		Image:  user.Image,
		Static: user.Static,
	}, nil
}
